sober as a judge
Not at all intoxicated, quite clear-headed, as in
Even after three drinks he was sober as a judge
. Why judges should be equated with sobriety is not known, but the simile was first recorded in 1694.